<?php
/**
 * Description of View
 *
 * @author henson
 */

class View
{
	private $tpl;
	
	public function __construct()
	{
		$this->tpl = new Smarty();
		$this->tpl->template_dir    = _ROOT.'/template';
		$this->tpl->compile_dir	    = _ROOT.'/template_c';
		$this->tpl->left_delimiter  = '{{';
		$this->tpl->right_delimiter = '}}';
	}
	public function showPage($tplDir, $arr_data = '')
	{
	    if( is_array($arr_data) ){
		$this->tpl->assign( "pageArray", $arr_data );
	    }
		$this->tpl->display( $tplDir );
	}

	public function fetchPage($tplDir, $arr_data = '')
	{
	    if( is_array($arr_data) ){
		$this->tpl->assign( "pageArray", $arr_data );
	    }
	    return $this->tpl->fetch( $tplDir );
	}
}

